/*
 * @Description: 字典下拉配置
 *  
 * @Date: 2021-03-31 10:33:53
 */

// Appid集合
let appData = new Object()

appData.appId = []

let codeMap = {
	'dxInfo': 'dx_info', //党校介绍
	'teacherspeak': 'teacherspeak', //师说红课
	'dx_bookshelf': 'dx_bookshelf', //党校书架
	'schoolimage': 'schoolimage', //校园映像
	'xzjg': 'xzjg', //行政架构
	'curr_leader': 'curr_leader', //现任领导
	'org_setting': 'org_setting', //机构设置
	'contact_info': 'contact_info', //联系方式
	'datadown': 'datadown', //资料下载,
	'trainingteacher': 'trainingteacher' //培训师资
}

let articleCode = new Object()
for(let key in codeMap) {
	articleCode[key] = codeMap[key]
}

// 提取文字name
let toString = (options, code) => {
	if (['', undefined, null, NaN].includes(code) || !options) {
		return ''
	}
	if (typeof code === 'boolean') {
		code = code ? 1 : 0
	}
	let o =
		options.find((item) => {
			return String(code) === String(item.code)
		}) || {}
	return o.name || ''
}
export default {
	toString,
	appData,
	articleCode
}
